package com.wits.qso.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.sf.json.JSONObject;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import com.wits.platform.entity.BaseEntity;

@Entity
@Table(name = "QSO_HOMEWORK_H")
public class HomeworkHView extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 746571869325528208L;

	private String id = null;
	private String title = null;
	private String file = null;
	private String url = null;

	/**
	 * 课程ID
	 */
	@Transient
	private String courseId;
	/**
	 * 课程名称
	 */
	@Transient
	private String courseName;
	/**
	 * 教师ID
	 */
	@Transient
	private String terId;
	/**
	 * 教师名称
	 */
	@Transient
	private String terName;

	public HomeworkHView() {
		super();
	}

	@Id
	@GenericGenerator(name = "idGen", strategy = "com.wits.platform.common.id.generator.IDGenerator", parameters = {
			@Parameter(name = "segment_value", value = "QSO_HWKH_ID"),
			@Parameter(name = "table_name", value = "wits_id_generator"),
			@Parameter(name = "value_column_name", value = "gen_value"),
			@Parameter(name = "segment_column_name", value = "gen_name"),
			@Parameter(name = "segment_value_length", value = "10"),
			@Parameter(name = "sq_format", value = "%08d"),
			@Parameter(name = "sq_prefix", value = "HV") })
	@GeneratedValue(generator = "idGen")
	@Column(name = "hwkh_id", nullable = false, insertable = true, updatable = false, length = 10)
	public String getId() {
		return id;
	}

	@Column(name = "hwkh_title", length = 100)
	public String getTitle() {
		return title;
	}

	@Column(name = "hwkh_file", length = 50)
	public String getFile() {
		return file;
	}

	@Column(name = "hwkh_url", length = 100)
	public String getUrl() {
		return url;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setFile(String file) {
		this.file = file;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "course_id")
	public String getCourseId() {
		return courseId;
	}

	public void setCourseId(String courseId) {
		this.courseId = courseId;
	}

	@Column(name = "course_title")
	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	@Column(name = "ter_id")
	public String getTerId() {
		return terId;
	}

	public void setTerId(String terId) {
		this.terId = terId;
	}

	@Column(name = "ter_name")
	public String getTerName() {
		return terName;
	}

	public void setTerName(String terName) {
		this.terName = terName;
	}

	public String display() {
		// TODO Auto-generated method stub
		return null;
	}

	public String toString() {
		return JSONObject.fromObject(this, HomeworkHView.getBaseJsonConfig())
				.toString();
	}
}
